package com.lbw;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableEurekaClient //开启客户端
public class BEurekaClientAApplication {

    public static void main(String[] args) {
        SpringApplication.run(BEurekaClientAApplication.class, args);
    }

    /**
     * 加上LoadBalanced就被LoadBalanced托管了
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
